.chat-item {
  border-bottom: 1px solid #d1d4d9;
  margin-bottom: 16px;  /* 减小底部间距 */
  padding: 8px;  /* 减小内边距 */
}

.chat-item:last-child {
  border-bottom: none;
}

.chat-item-header {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
}

.chat-item-avatar {
  width: 24px;
  height: 24px;
  margin-right: 10px;
}

.chat-item-title {
  flex: 1;
}

.chat-item-edit {
  width: 16px;
  height: 16px;
  margin-left: 10px;
}

.chat-item-content-ai {
  color: #5662f6;
  font-style: italic;
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  margin-bottom: 10px;
}

.chat-item-content-ai > img {
  width: 18px;
  height: 18px;
  margin-left: 4px;
}

.chat-message {
  margin-bottom: 12px;
  position: relative;
}

.chat-message.assistant .chat-item-content-inner {
  background: #eef0fd;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 32px;  /* 为底部工具栏留出空间 */
}

.chat-item-tools {
  position: absolute;
  left: 0;
  bottom: 8px;
  display: flex;
  gap: 16px;
  opacity: 0;
  transition: opacity 0.3s;
}

.chat-message.assistant:hover .chat-item-tools {
  opacity: 1;
}

.chat-item-tools .ant-btn {
  padding: 4px;
  height: 24px;
  width: 24px;
  min-width: 24px;
  border: none;
  color: #666;
  background: transparent;
}

.chat-item-tools .ant-btn:hover {
  color: #5662f6;
}

/* 移除旧的按钮样式 */
.message-actions {
  display: none;
}

.chat-message.assistant .message-actions {
  position: absolute;
  left: 16px;
  bottom: -32px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.3s;
}

.chat-message.assistant:hover .message-actions {
  opacity: 1;
}

.message-actions .ant-btn {
  padding: 4px;
  height: 24px;
  width: 24px;
  min-width: 24px;
  border: none;
  color: #666;
  background: transparent;
}

.message-actions .ant-btn:hover {
  color: #5662f6;
  background: rgba(86, 98, 246, 0.1);
}

.chat-message.user .chat-item-content-inner {
  background: #f5f5f5;
  padding: 8px 12px;  /* 调整内边距 */
  border-radius: 8px;
  margin-bottom: 12px;  /* 减小底部间距 */
}

.chat-message.assistant .chat-item-content-inner {
  background: #eef0fd;
  padding: 8px 12px;  /* 调整内边距 */
  border-radius: 8px;
  margin-bottom: 12px;  /* 减小底部间距 */
}

.chat-item-content-inner {
  font-size: 14px;
  line-height: 1.4;
}

.chat-item-content-inner p {
  margin: 0;
  padding: 0;
  line-height: 1.4;  /* 设置为与文字大小相近的行高 */
}

.chat-item-content-inner ul,
.chat-item-content-inner ol {
  margin: 4px 0 4px 16px;  /* 只保留最小的上下间距 */
  padding: 0;
}

.chat-item-content-inner li {
  line-height: 1.4;  /* 统一行高 */
  margin: 0;
  padding: 0;
}

/* 移除所有标题的额外边距 */
.chat-item-content-inner h1,
.chat-item-content-inner h2,
.chat-item-content-inner h3,
.chat-item-content-inner h4 {
  margin: 4px 0;
  padding: 0;
  line-height: 1.4;
}

/* 移除第一个元素的顶部边距 */
.chat-item-content-inner > *:first-child {
  margin-top: 0;
}

/* 移除最后一个元素的底部边距 */
.chat-item-content-inner > *:last-child {
  margin-bottom: 0;
}

.chat-item-content-inner h1,
.chat-item-content-inner h2,
.chat-item-content-inner h3,
.chat-item-content-inner h4 {
  margin-top: 12px;  /* 减小标题上边距 */
  margin-bottom: 6px;  /* 减小标题下边距 */
}

.chat-item-content-inner p {
  margin-bottom: 4px;  /* 减小段落间距 */
}

.chat-item-content-inner ul,
.chat-item-content-inner ol {
  margin-left: 16px;
  margin-bottom: 4px;  /* 减小列表间距 */
  margin-top: 4px;    /* 添加上边距控制 */
}

.chat-item-content-inner li {
  margin-bottom: 2px;  /* 添加列表项间距控制 */
}
